The present invention relates to an image processing apparatus, and more particularly to an apparatus capable of compressing, for example, images efficiently without any loss.
It is usual recently that, in apparatus for handling image data, compression of image data is executed so as to reduce the amount of data to be stored or transmitted. For example, there is employed technology of lossless compression (in saving information).
In the known lossless compression technology, there are methods of CALIC, JPEG-LS and so forth.
Regarding the compression method known as CALIC (A Context-based, Adaptive, Lossless Image Codec), the details thereof are disclosed in, e.g., X. Wu and N. Memon, xe2x80x9cContext-Based, Adaptive, Lossless Image Coding, IEEE Transactions on Communicationsxe2x80x9d, Vol. 45, No. 4, April 1997, pp. 437-444.
Meanwhile, regarding the other compression method known as JPEG-LS (Joint Photographic Experts Group Lossless), the details thereof are disclosed in, e.g., xe2x80x9cLossless and Near-Lossless Coding of Continuous Tone Still Imagesxe2x80x9d, ISO/IEC JTC1/SC29 WG1 14495.
In the compression methods of CALIC and JPEG-LS, there is adopted DPCM (Differential Pulse Code Modulation), wherein pixels of each image are scanned per row (line) and per column. The DPCM is a technique of predicting a subject pixel from peripheral pixels and encoding a prediction error signal thereof. It is capable of encoding the signal without impairing the information amount of the original image.
When such lossless compression is executed, a prediction signal is calculated, with regard to individual pixels, on the basis of peripheral pixel values around each pixel (subject pixel). An entropy encoder encodes the prediction error signal of the calculated pixel value, i.e., the difference between the prediction signal and the effective pixel value (actual signal).
FIG. 1 is a block diagram for explaining a conventional lossless image compressing apparatus.
In an image buffer 1, there is stored an image inputted from an unshown external device. A pixel sequence generator 2 scans the image stored in the image buffer 1, then extracts, with regard to each pixel, peripheral pixels from the current subject pixel, and supplies the value of the current subject pixel to an adder 4 while supplying the values of the generated peripheral pixels to a predictor 3.
The predictor 3 generates a prediction signal on the basis of the peripheral pixel values obtained from the pixel sequence generator 2, and then supplies the prediction signal to the adder 4. Subsequently the adder 4 subtracts the prediction signal, which has been supplied thereto from the predictor 3, from the current pixel value obtained from the pixel sequence generator 2, and supplies a prediction error signal to an entropy encoder 5.
Details of a simplified effective predictor 3 are disclosed in, e.g., S. Martucci, xe2x80x9cReversible Compression of HDTV Images using Median Adaptive Prediction and Arithmetic Codingxe2x80x9d, IEEE 1990.
The entropy encoder 5 generates a compressed code word from the sequence of the prediction error signal supplied from the adder 4, and then outputs such a code word.
The prediction error signal is encoded as a variable-length prefix and a fixed-length suffix. The variable-length prefix is composed of a series of xe2x80x9c0xe2x80x9d bits that succeed a xe2x80x9c1xe2x80x9d bit. The sequence of the prediction error signal is divided by block. In each block, the optimal length of the suffix is decided first, and a code word is transmitted prior to being combined with the individual prediction error signal of the block.
Details of the entropy encoder 5 are disclosed in, e.g., R. Rice, xe2x80x9cLossless Coding Standards for Space Data Systemsxe2x80x9d, IEEE 1997.
However, since the known lossless compression methods described above is dependent on the past prediction progress, there exists a problem that a memory is required for storing the past prediction progress.
The present invention has been made in view of the circumstances. And it is an object of the invention to realize more efficient lossless compression of images by selectively inverting the polarity of a prediction error signal without maintaining the past prediction progress.
An image processing apparatus of the present invention includes first generator for measuring the pixel values of three peripheral pixels adjacent to a subject pixel currently, and generating a first prediction signal from the measuring result; second generator for generating a second prediction signal which represents the average value of the maximum and the minimum out of the measured values of the three peripheral pixels; calculator for calculating a prediction error signal on the basis of the first prediction signal generated by the first generator and the pixel-value of the subject pixel; comparator for comparing the first prediction signal generated by the first generator with the second prediction signal generated by the second generator; inverter for inverting, on the basis of the comparison result obtained from the comparator, the polarity of the prediction error signal calculated by the calculator; and invertercode word allocator for allocating a code word in accordance with the prediction error signal inverted in polarity by the inverter.
The first generator measures the values A, B and A+Bxe2x88x92C from the respective values A, B and C of the three peripheral pixels, and generates the intermediate value thereof as a first prediction signal.
When the first prediction signal generated by the first generator is greater than the second prediction signal generated by the second generator, the inverter may be capable of not inverting the polarity of the prediction error signal.
The peripheral pixels may consist of the pixel on the left side of the subject pixel, the pixel on the upper side of the subject pixel, and the pixel on the upper left side of the subject pixel.
The first generator may be a median adaptive predictor.
An image processing method of the present invention includes a first generation step of measuring the pixel values of three peripheral pixels adjacent to a subject pixel currently, and generating a first prediction signal from the measuring result; a second generation step of generating a second prediction signal which represents the average value of the maximum and the minimum out of the measured values of the three peripheral pixels; a calculation step of calculating a prediction error signal on the basis of the first prediction signal generated by the process at the first generation step and the pixel value of the subject pixel; comparison step of comparing the first prediction signal generated by the process at the first generation step with the second prediction signal generated by the process at the second generation step; an inversion control step of controlling, on the basis of the comparison result obtained by the process at the comparison step, inversion of the polarity of the prediction error signal calculated by the process at the calculation step; and a code word allocation step of allocating a code word in accordance with the prediction error signal controlled, with regard to inversion of its polarity, by the process at the inversion control step.
The first generator step measures the values A, B and A+Bxe2x88x92C from the respective values A, B and C of the three peripheral pixels, and generates the intermediate value thereof as a first prediction signal.
When the first prediction signal generated by the process at the first generation step is greater than the second prediction signal generated by the process at the second generation step, the polarity of the prediction error signal is not inverted at the inversion control step.
When the first prediction signal generated by the process at the first generation step is smaller than the second prediction signal generated by the process at the second generation step, the polarity of the prediction error signal is inverted at the inversion control step.
The peripheral pixels are composed of the pixel on the left side of the subject pixel, the pixel on the upper side of the subject pixel, and the pixel on the upper left side of the subject pixel.
In the present invention, the intermediate value of three peripheral pixels adjacent to the subject pixel currently is measured to generate a first prediction signal from the measuring result, and the average value of the maximum and the minimum out of the measured values of the three peripheral pixels is generated as a second prediction signal. Then a prediction error signal is calculated on the basis of the first prediction signal and the pixel value of the subject pixel, and the polarity of the prediction error signal thus calculated is inverted on the basis of the result of comparing the first prediction signal with the second prediction signal. And subsequently a code word is allocated in accordance with the prediction error signal.